package com.example.demo.service;

import com.example.demo.entity.Daka;
import com.example.demo.entity.Login;
import com.example.demo.entity.Student;
import com.example.demo.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:wjup
 * @Date: 2018/9/26 0026
 * @Time: 15:23
 */
@Service
public class StudentService {
    @Autowired
    StudentMapper studentMapper;

    public Student Sel(int id) {
        return studentMapper.Sel(id);
    }

    public List<Student> Sel2() {
        return studentMapper.Sel2();
    }

    public List<Student> Sel3() {
        return studentMapper.Sel3();
    }

    public List<Student> Sel4() {
        return studentMapper.Sel4();
    }

    public List<Student> Sel5(int sid) {
        return studentMapper.Sel5(sid);
    }

    public Student Sel6(int sid) {
        return studentMapper.Sel6(sid);
    }

    public List<Daka> Sel7(int sid) {
        return studentMapper.Sel7(sid);
    }

    public Student Sel8(int id) {
        return studentMapper.Sel8(id);
    }

    public int insertStudent(Student student){
        return studentMapper.insertStudent(student);
    }

    public int insertInformation(Student student){
        updateDaka(student.getClockId());
        return studentMapper.insertInformation(student);
    }

    public int updateState(Student student){
        return studentMapper.updateState(student);
    }

    public int updateInformation(Student student){
        return studentMapper.updateInformation(student);
    }

    public int updateDaka(int id){
        return studentMapper.updateDaka(id);
    }

    public int updateStudent(Student student){
        return studentMapper.updateStudent(student);
    }

    public int updateLogin(Student student){
        return studentMapper.updateLogin(student);
    }

    public Login login(Login login){
        return studentMapper.login(login);
    }

    public int insertDaka(List<Student> str){
        return studentMapper.insertDaka(str);
    }

    public int deleteLogin(int sid) {
        return studentMapper.deleteLogin(sid);
    }

    public int deleteInformation(int sid) {
        return studentMapper.deleteInformation(sid);
    }

    public int deleteDaka(int sid) {
        return studentMapper.deleteDaka(sid);
    }

    public int deleteStudent(int sid) {
        deleteLogin(sid);
        deleteDaka(sid);
        deleteInformation(sid);
        return studentMapper.deleteStudent(sid);
    }
}